namespace Bowlus.FrontEnd.PortalAdminService
{
    using System.ServiceModel;
    using System.ServiceModel.Web;

    /*
 * Returns JSON:
 * [{"TenantId":"bhushan","HostName":"bhushan.thecloudsamurai.com","Application":"myapp1.2.zip","AppHostInstanceId":"Bowlus.AppHost_IN_0","AppHostInstanceIp":"10.115.34.204","Status":"active","TargetInstanceIpAddress":"127.0.0.1","StandbyInstanceIpAddress":"","Timestamp":"\/Date(1318268345557)\/","PartitionKey":"_bowlus","RowKey":"bhushan"},
 * {"TenantId":"dan","HostName":"dan.thecloudsamurai.com","Application":"myapp1.2.zip","AppHostInstanceId":"Bowlus.AppHost_IN_1","AppHostInstanceIp":"10.115.56.85","Status":"active","TargetInstanceIpAddress":"127.0.0.1","StandbyInstanceIpAddress":"","Timestamp":"\/Date(1318268345756)\/","PartitionKey":"_bowlus","RowKey":"dan"},
 * {"TenantId":"ercenk","HostName":"ercenk.thecloudsamurai.com","Application":"myapp1.1.zip","AppHostInstanceId":"Bowlus.AppHost_IN_2","AppHostInstanceIp":"10.115.238.23","Status":"active","TargetInstanceIpAddress":"127.0.0.1","StandbyInstanceIpAddress":"","Timestamp":"\/Date(1318268345956)\/","PartitionKey":"_bowlus","RowKey":"ercenk"}]
 * */

    [ServiceContract(Namespace = "Bowlus.FrontEnd.AdminService")]
    public interface IAdminService
    {
        // Use WebInvoke to avoid server side cache (WebGet will use cache by default)
        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
        string GetTenantDeployment();

        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
        string GetApplications();

        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "GetCustomizations/app={app}")]
        string GetCustomizations(string app);

        // http://localhost:8081/AdminService.svc/CreateTenant/tenantId=trent/app=site1.3.zip
        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "CreateTenant/tenantId={tenantId}/app={app}/customization={customization}")]
        string CreateTenant(string tenantId, string app, string customization);

        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
        string GetInstanceStatus();

        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
        string IsInfrastructureReady();
    }
}